{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Title: #Smallest Index With Equal Value"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Difficulty: #Easy"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Category Title: #Algorithms"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Tag Slug: #array"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Name Translated: #数组"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Solution Name: smallestEqual"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Translated Title: #值相等的最小索引"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Translated Content:\n",
    "<p>给你一个下标从 0 开始的整数数组 <code>nums</code> ，返回 <code>nums</code> 中满足<em> </em><code>i mod 10 == nums[i]</code><em> </em>的最小下标 <code>i</code> ；如果不存在这样的下标，返回<em> </em><code>-1</code><em> </em>。</p>\n",
    "\n",
    "<p><code>x mod y</code> 表示 <code>x</code> 除以 <code>y</code> 的 <strong>余数</strong> 。</p>\n",
    "\n",
    "<p>&nbsp;</p>\n",
    "\n",
    "<p><strong>示例 1：</strong></p>\n",
    "\n",
    "<pre><strong>输入：</strong>nums = [0,1,2]\n",
    "<strong>输出：</strong>0\n",
    "<strong>解释：</strong>\n",
    "i=0: 0 mod 10 = 0 == nums[0].\n",
    "i=1: 1 mod 10 = 1 == nums[1].\n",
    "i=2: 2 mod 10 = 2 == nums[2].\n",
    "所有下标都满足 i mod 10 == nums[i] ，所以返回最小下标 0\n",
    "</pre>\n",
    "\n",
    "<p><strong>示例 2：</strong></p>\n",
    "\n",
    "<pre><strong>输入：</strong>nums = [4,3,2,1]\n",
    "<strong>输出：</strong>2\n",
    "<strong>解释：</strong>\n",
    "i=0: 0 mod 10 = 0 != nums[0].\n",
    "i=1: 1 mod 10 = 1 != nums[1].\n",
    "i=2: 2 mod 10 = 2 == nums[2].\n",
    "i=3: 3 mod 10 = 3 != nums[3].\n",
    "2 唯一一个满足 i mod 10 == nums[i] 的下标\n",
    "</pre>\n",
    "\n",
    "<p><strong>示例 3：</strong></p>\n",
    "\n",
    "<pre><strong>输入：</strong>nums = [1,2,3,4,5,6,7,8,9,0]\n",
    "<strong>输出：</strong>-1\n",
    "<strong>解释：</strong>不存在满足 i mod 10 == nums[i] 的下标\n",
    "</pre>\n",
    "\n",
    "<p><strong>示例 4：</strong></p>\n",
    "\n",
    "<pre><strong>输入：</strong>nums = [2,1,3,5,2]\n",
    "<strong>输出：</strong>1\n",
    "<strong>解释：</strong>1 是唯一一个满足 i mod 10 == nums[i] 的下标\n",
    "</pre>\n",
    "\n",
    "<p>&nbsp;</p>\n",
    "\n",
    "<p><strong>提示：</strong></p>\n",
    "\n",
    "<ul>\n",
    "\t<li><code>1 &lt;= nums.length &lt;= 100</code></li>\n",
    "\t<li><code>0 &lt;= nums[i] &lt;= 9</code></li>\n",
    "</ul>\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Description: [smallest-index-with-equal-value](https://leetcode.cn/problems/smallest-index-with-equal-value/description/)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Solutions: [smallest-index-with-equal-value](https://leetcode.cn/problems/smallest-index-with-equal-value/solutions/)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "test_cases = ['[0,1,2]', '[4,3,2,1]', '[1,2,3,4,5,6,7,8,9,0]']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "from typing import List\r\n",
    "class Solution:\r\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\r\n",
    "        for i, num in enumerate(nums):\r\n",
    "            if i % 10 == num:\r\n",
    "                return i\r\n",
    "        return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for i,j in enumerate(nums):\n",
    "            if i%10==j:\n",
    "                return i\n",
    "                break\n",
    "        else:\n",
    "            return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        n = len(nums)\n",
    "        for i in range(n):\n",
    "            if i%10==nums[i]:\n",
    "                return i\n",
    "        return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for i in range(len(nums)):\n",
    "            if i % 10 == nums[i]:\n",
    "                return i\n",
    "        return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for idx, num in enumerate(nums):\n",
    "            if idx % 10 == num:\n",
    "                return idx\n",
    "        return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        ans = inf\n",
    "        for i, num in enumerate(nums):\n",
    "            if i % 10 == num:\n",
    "                ans = min(i, ans) \n",
    "        return ans if ans != inf else -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for i in range(len(nums)):\n",
    "            if i % 10 == nums[i]:\n",
    "                return i\n",
    "\n",
    "        else:\n",
    "            return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for i in range(len(nums)):\n",
    "            if i % 10 == nums[i]:\n",
    "                return i\n",
    "        return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for i in range(len(nums)):\n",
    "            if i % 10 == nums[i]:\n",
    "                return i\n",
    "        return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums):\n",
    "        for i,n in enumerate(nums):\n",
    "            if n == i%10:\n",
    "                return i\n",
    "        return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for i in range(len(nums)):\n",
    "            if i % 10 == nums[i]:\n",
    "                return i\n",
    "        return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        data_min = 200\n",
    "        for i in range(len(nums)):\n",
    "            if i % 10 == nums[i]:\n",
    "                data_min = min(data_min,i)\n",
    "        if data_min == 200:\n",
    "            return -1\n",
    "        else:\n",
    "            return data_min"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for i in range(len(nums)):\n",
    "            if i%10==nums[i]:\n",
    "                return i\n",
    "        return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for i, num in enumerate(nums):\n",
    "            if i % 10 == num:\n",
    "                return i\n",
    "        return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        n= len(nums)\n",
    "        for i in range(n):\n",
    "            if i % 10 == nums[i]:\n",
    "                return i\n",
    "        return -1\n",
    "        \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for i in range(len(nums)):\n",
    "            if i % 10 == nums[i]:\n",
    "                return i\n",
    "        return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        n = len(nums)\n",
    "        for i in range(n):\n",
    "            if i % 10 == nums[i]:\n",
    "                return i\n",
    "        return -1\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for i in range(len(nums)):\n",
    "            if(i % 10 == nums[i]):\n",
    "                return i\n",
    "        return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for idx, num in enumerate(nums):\n",
    "            if (idx % 10) == num:\n",
    "                return idx\n",
    "        return -1\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "\n",
    "        for i in range(len(nums)):\n",
    "            if (i % 10 == nums[i]):\n",
    "                return i\n",
    "        return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for i in range(len(nums)):\n",
    "            if i % 10 == nums[i]:\n",
    "                return i\n",
    "        return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        n=len(nums)\n",
    "        for i in range(n):\n",
    "            if i%10==nums[i]:\n",
    "                return i\n",
    "        return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        return next((i for i, j in enumerate(nums) if (i % 10) == j), -1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        ans=-1\n",
    "        for i in range(len(nums)):\n",
    "            if i%10==nums[i]:\n",
    "                ans=i\n",
    "                break\n",
    "        return ans"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for i in range(len(nums)):\n",
    "            if i % 10 == nums[i]:\n",
    "                return i\n",
    "        return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for k,v in enumerate(nums):\n",
    "            if k%10==v:\n",
    "                return k\n",
    "        return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for i in range(len(nums)):\n",
    "            if i % 10 == nums[i]:\n",
    "                return i\n",
    "        return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for i in range(len(nums)):\n",
    "            if i%10==nums[i]:\n",
    "                return i\n",
    "                break\n",
    "        else:\n",
    "            return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for i in range(len(nums)):\n",
    "            if i%10 ==nums[i]:\n",
    "                return i\n",
    "        return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for i in range(len(nums)):\n",
    "            if i % 10 == nums[i]:\n",
    "                return i\n",
    "        return -1\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for idx, num in enumerate(nums):\n",
    "            if idx % 10 == num:\n",
    "                return idx\n",
    "        return -1\n",
    "                "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for i in range(len(nums)):\n",
    "            _, yushu = divmod(i, 10)\n",
    "            if yushu == nums[i]:\n",
    "                return i\n",
    "        return -1\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: list[int]) -> int:\n",
    "        n = len(nums)\n",
    "        for i in range(n):\n",
    "            if i % 10 == nums[i]:\n",
    "                return i\n",
    "        return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        re = -1\n",
    "        for i, num in enumerate(nums):\n",
    "            n = i % 10\n",
    "            if n == num:\n",
    "                return i\n",
    "        return re"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        data=[]\n",
    "        s=-1\n",
    "        for i,num in enumerate(nums):\n",
    "            if i % 10==num:\n",
    "                data.append(i)\n",
    "        if data:\n",
    "            s=min(data)\n",
    "        return s"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for i,v in enumerate(nums):\n",
    "            if i%10==v:\n",
    "                return i\n",
    "        return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for i in range(len(nums)):\n",
    "            if i%10==nums[i]:\n",
    "                return i\n",
    "        return -1\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for i, num1 in enumerate(nums):\n",
    "            if i % 10 == num1:\n",
    "                return i\n",
    "        \n",
    "        return -1\n",
    "            \n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for i in range(len(nums)):\n",
    "            if i % 10 == nums[i]:\n",
    "                return i\n",
    "        return -1\n",
    "        \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for i in range(len(nums)):\n",
    "            if i % 10 == nums[i]:\n",
    "                return i\n",
    "        return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for i in range(len(nums)):\n",
    "            if nums[i] == i % 10:\n",
    "                return i\n",
    "        return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for i,n in enumerate(nums):\n",
    "            if i%10==n:\n",
    "                return i\n",
    "        else:\n",
    "            return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for i in range(len(nums)):\n",
    "            if i %10==nums[i]:\n",
    "                return i\n",
    "        return -1\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for i,v in enumerate(nums):\n",
    "            if i%10==v%10:\n",
    "                return i\n",
    "        return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for i,v in enumerate(nums):\n",
    "            if i%10==v:\n",
    "                return i\n",
    "        return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        result=0\n",
    "        for i in range(0,len(nums)):\n",
    "            if i%10 ==nums[i]:\n",
    "                result=i\n",
    "                \n",
    "                break\n",
    "            else :\n",
    "                result=-1\n",
    "        return result\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:    \n",
    "        return ([i for i in range(len(nums)) if i % 10 == nums[i]]+[-1])[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        res = len(nums)\n",
    "        for i,j in enumerate(nums):\n",
    "            if i%10 ==j:\n",
    "                res = min(res,i)\n",
    "        return res if res != len(nums) else -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        res = -1\n",
    "        for idx, num in enumerate(nums):\n",
    "            if idx % 10 == num:\n",
    "                return idx\n",
    "        return res\n",
    "                "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        return next((i for i, j in enumerate(nums) if i % 10 == j), -1)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for i, n in enumerate(nums):\n",
    "            if i % 10 == n:\n",
    "                return i\n",
    "        return -1\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        index = []\n",
    "        for i, num in enumerate(nums):\n",
    "            if i%10 == num:\n",
    "                index.append(i)\n",
    "        if index:\n",
    "            return min(index)\n",
    "        else:\n",
    "            return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        ans = []\n",
    "        for i in range(len(nums)):\n",
    "            if i % 10 == nums[i]:\n",
    "                ans.append(i)\n",
    "        ans.sort()\n",
    "        return ans[0] if ans else -1\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for i,x in enumerate(nums):\n",
    "            if i%10==x:return i\n",
    "        return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for i in range(len(nums)):\n",
    "            if i % 10 == nums[i]:\n",
    "                return i\n",
    "        return -1        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        n = len(nums)\n",
    "\n",
    "        for i in range(n):\n",
    "            if i % 10 == nums[i]:\n",
    "                return i\n",
    "        return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        return next((i for i in range(len(nums)) if i % 10 == nums[i]), -1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        n = len(nums)\n",
    "        for i in range(n):\n",
    "            if i % 10 == nums[i]:\n",
    "                return i\n",
    "        return -1\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        n = len(nums)\n",
    "        for i in range(n):\n",
    "            if i % 10 == nums[i]:\n",
    "                return i\n",
    "        return -1 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for i in range(len(nums)):\n",
    "            if i%10==nums[i]:\n",
    "                return i\n",
    "                break\n",
    "        return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for i,v in enumerate(nums):\n",
    "            if i%10==v:\n",
    "                return i\n",
    "        return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for index, value in enumerate(nums):\n",
    "            if index % 10 == value:\n",
    "                return index\n",
    "        return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for i in range(len(nums)):\n",
    "            if i % 10 == nums[i]:\n",
    "                return i\n",
    "        return -1\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: list[int]) -> int:\n",
    "        \n",
    "        list1=[]\n",
    "        for i in range(len(nums)):\n",
    "            if i%10 == nums[i] :\n",
    "                list1.append(i)\n",
    "\n",
    "        if len(list1) != 0:\n",
    "            return min(list1)\n",
    "        else:\n",
    "            return -1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for i in range(len(nums)):\n",
    "            if nums[i] == i % 10:\n",
    "                return i\n",
    "        return -1\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        res = 0\n",
    "        for i in range(len(nums)):\n",
    "            if i % 10 == nums[i]:\n",
    "                res = i\n",
    "                break\n",
    "            else:\n",
    "                res = -1\n",
    "\n",
    "        return res\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List\n",
    "import collections\n",
    "\n",
    "class Solution:\n",
    "    def smallestEqual(self, nums: List[int]) -> int:\n",
    "        for i in range(len(nums)):\n",
    "            if i%10==nums[i]:\n",
    "                return i\n",
    "        return -1\n",
    "\n"
   ]
  }
 ],
 "metadata": {},
 "nbformat": 4,
 "nbformat_minor": 2
}
